<#assign pageName="用户授权Token管理">
<@override name="page-content">
<form class="layui-form form-horizontal" role="form" method="post">
    <div class="layui-form-search panel">
        <input type="text" hidden="hidden" name="_STATE"/>
        <@ctrl.SingleSelectQuery path="oauthAccessToken.grantType" options={"": "全部", "password":"password", "client_credentials":"client_credentials"} text="1" value="0" labelText="授权类型">
         </@ctrl.SingleSelectQuery>
        <@ctrl.TextboxQuery path="oauthAccessToken.userName" labelText="用户名称"/>
        <@ctrl.TextboxQuery path="oauthAccessToken.clientId" labelText="客户端ID"/>
        <div class="margin-5"> 
            <a href="javascript:;" onclick="$('form:first').submit();" class="layui-btn layui-btn-sm">
                <i class="layui-icon layui-icon-search"></i>查询
            </a>
            <a href="javascript:;" class="layui-btn layui-btn-warm layui-btn-sm js-reset">
                <i class="layui-icon layui-icon-refresh-1"></i>重置
            </a>
        </div>
    </div>
    <table class="layui-table">
       <thead>
           <tr>
                <th class="align-center" width="50px" nowrap="nowrap">序号</th>
                <th class="align-center" nowrap="nowrap">用户名称</th>
                <th class="align-center" nowrap="nowrap">客户端ID</th>
                <th class="align-center" nowrap="nowrap">授权类型</th>
                <th class="align-center" nowrap="nowrap">授权时间</th>
                <th class="align-center" width="100px">操作</th>
            </tr>
        </thead>
        <tbody>
        <#if (queryResult.rows)?has_content>
            <#list queryResult.rows as dataItem>
                <tr>
                    <td class="align-center"  width="50px" nowrap="nowrap">
                        ${(pageNo-1)*pageSize+dataItem_index+1}
                    </td>
                    <td class="align-center" nowrap="nowrap">
                        ${dataItem.uname!"－"}
                    </td>
                    <td class="align-center">
                        ${dataItem.client_id}
                    </td>
                    <td class="align-center">
                        <#if dataItem.uname?has_content>
                            password
                        <#else>
                            client_credentials
                        </#if>
                    </td>
                    <td class="align-center">
                        ${dataItem.create_time?datetime}
                    </td>
                    <td class="align-center">
                        <div class="layui-table-cell">
                            <button type="button" class="layui-btn layui-btn-danger layui-btn-xs"
                                onclick="confirmSubmit('确定要删除‘${dataItem.uname}’授权信息吗？', {tokenId:'${dataItem.token_id}',access_token:'${token}'},'del')">
                                <i class="layui-icon layui-icon-delete"></i>删除
                            </button>
                        </div>
                    </td>
                </tr>
            </#list>
        <#else>
            <tr>
                <td colspan="7" style="color:red;text-align:center;font-weight:bold;">暂无符合条件的授权信息</td>
            </tr>
        </#if>
        </tbody>
    </table>
    <@ctrl.pageShow (queryResult.total)!0, (queryResult.pageIndex)!0 />
</form>
</@override>
<@override name="page-scripts">
    <script>
        $(function(){
            layui.use(['form','layer', 'jquery'], function(){
                var form=layui.form;
                var layer=layui.layer;
                var $ = layui.jquery;
                $('.js-reset').on('click', function(){
                    $('#pageNo').val(1);
                    $('#grantType').val("");
                    $('#userName').val("");
                    $('#clientId').val("");
                    $('form:first').submit();
                });
            })
        })
    </script>
</@override>
<@extends name="/layout/basepage.html"/> 